package io.gitee.zhangbinhub.acp.cloud.oauth.test

import cn.dev33.satoken.oauth2.data.model.AccessTokenModel
import com.fasterxml.jackson.databind.ObjectMapper
import org.junit.jupiter.api.Test

class JsonTest {
    @Test
    fun jsonStrToObj() {
        val jsonStr = """
            {"accessToken":"x9BUeHKloltFoSb9l8kUc2K4MZqEiyy4ASlhUMk9J8CUOqutrgrk0pfXBrWM","refreshToken":"mZ4gvTByQAdCxFWIc71rAUhnJnZHqg01SJxFv9lRmcmrTE6IvFoWhEYTDd8R","expiresTime":1742982659978,"refreshExpiresTime":1743068459978,"clientId":"test","loginId":"user","scopes":["ALL"],"tokenType":"bearer","grantType":"password","extraData":{},"createTime":1742982059978}
        """.trimIndent()
        val objectMapper = ObjectMapper()
        val accessTokenModel = objectMapper.readValue(jsonStr, Object::class.java) as AccessTokenModel
        println(accessTokenModel)
    }
}